package com.kust.smarthome.web.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.kust.smarthome.web.mapper.TelevisionMapper;
import com.kust.smarthome.web.model.Television;
import com.kust.smarthome.web.service.ITelevisionService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author iAuzre
 * @since 2021-06-28
 */
@Service
public class TelevisionServiceImpl extends ServiceImpl<TelevisionMapper, Television> implements ITelevisionService {

    @Resource
    private TelevisionMapper televisionMapper;

    @Override
    public int insert(Television television) {
        return televisionMapper.insert(television);
    }

    @Override
    public List<Television> getByUserId(Integer userId) {
        QueryWrapper<Television> query = new QueryWrapper<>();
        query.eq("user_id",userId);
        return televisionMapper.selectList(query);
    }
}
